import {notification} from "antd";
import {CheckCircleOutlined, CloseCircleOutlined, AlertOutlined} from "@ant-design/icons";


function SuccessNotice(desc, duration = 0) {
    openNotification(desc, "成功", <CheckCircleOutlined style={{color: "green"}}/>, duration)
}

function FailedNotice(desc, duration = 0) {
    openNotification(desc, "失败", <CloseCircleOutlined style={{color: "red"}}/>, duration)
}

function InfoNotice(desc, title = "提示", duration = 0) {
    openNotification(desc, title, <AlertOutlined style={{color: "green"}}/>, duration)
}

export {SuccessNotice, FailedNotice,InfoNotice}

function openNotification(desc, title, icon, duration = 0) {
    const args = {
        message: title,
        description: desc,
        duration: duration,
        icon: icon
    };
    notification.open(args);
}

